package com.padakeji.android.pworks.content;

import android.graphics.Bitmap;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ImageView;

/**
 * Created by AtanL on 2015/9/16.
 */
public interface PadaImageLoader {

    interface PadaImageLoadingListener {
        void onLoadingStart(String imageUri, View view);
        void onLoadingProcessUpdate(String imageUri, View view, int current, int total);
        void onLoadingFinish(String imageUri, View view, Bitmap loadedImage);
        void onLoadingFailed(String imageUri, View view, Throwable t);
        void onLoadingCancelled(String imageUri, View view);
    }

    void display(String imageUri, ImageView imageView);

    /**
     * 把uri所指向的图片资源设置到imageView中。
     *
     * @param imageUri
     * @param imageView
     * @param imageOnLoading 加载过程中显示的图片
     * @param imageOnFailure 加载失败显示的图片
     */
    void display(@NonNull String imageUri, @NonNull ImageView imageView, @DrawableRes int imageOnLoading, @DrawableRes int imageOnFailure, PadaImageLoadingListener l);


}
